package com.shell.guard.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.shell.ssoServer.filter.SSOLoginFilter;
import com.shell.ssoServer.filter.SSOLogoutFilter;

@Configuration
public class SSOConfig {

	@Bean
	public FilterRegistrationBean SSOLoginFilter() {
		FilterRegistrationBean registration = new FilterRegistrationBean(new SSOLoginFilter(),
				new ServletRegistrationBean[0]);
		registration.addUrlPatterns(new String[] { "/login" });
		return registration;
	}

	@Bean
	public FilterRegistrationBean SSOLogoutFilter() {
		FilterRegistrationBean registration = new FilterRegistrationBean(new SSOLogoutFilter(),
				new ServletRegistrationBean[0]);
		registration.addUrlPatterns(new String[] { "/logout" });
		registration.setOrder(2147483547);
		return registration;
	}
}
